﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Configuration;
using DropBoxClient.Entities;

namespace DropBoxClient.Tests
{
    [TestClass]
    public class GetDeltaTest
    {
        private string accessToken;
        private OAuth2Client client;
        private DropBoxState state;

        [TestInitialize]
        public void Init()
        {
            accessToken = ConfigurationManager.AppSettings["AccessToken"];
            client = new OAuth2Client(accessToken);
            state = client.GetDelta(string.Empty);
        }

        [TestMethod]
        public void GetDelta_ResultIsNotNull()
        {
            Assert.IsNotNull(state);
        }

        [TestMethod]
        public void GetDelta_HasDelta()
        {
            Assert.IsTrue(state.DeltaEntries.Count > 0);
        }

        [TestMethod]
        public void GetDelta_RepeatedCallsGiveNoDelta()
        {
            state = client.GetDelta(state.Cursor);
            Assert.IsTrue(state.DeltaEntries.Count == 0);
        }

    }
}
